Skip to content

chore(ssa refactor): Optimize constant jmpifs into jmps#1374

Merged
joss-aztec merged 8 commits intomasterfrom
jf/ssa-simplify-constant-if
May 23, 2023
Merged

chore(ssa refactor): Optimize constant jmpifs into jmps#1374
joss-aztec merged 8 commits intomasterfrom
jf/ssa-simplify-constant-if

Conversation

@jfecher
Copy link
Copy Markdown
Contributor

@jfecher jfecher commented May 18, 2023

Related issue(s)

Resolves #

Description

Summary of changes

This is a small but important extra job for the simplify-cfg pass. It replaces any jmpif terminator instructions with jmps if the condition is a known constant. This takes place before the inlining block into its predecessor check, so if removing one of the block's successors causes that optimization to apply, the if construct will be completely flattened into one block.

Dependency additions / changes

Test additions / changes

Checklist

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt with default settings.
  • I have linked this PR to the issue(s) that it resolves.
  • I have reviewed the changes on GitHub, line by line.
  • I have ensured all changes are covered in the description.

Documentation needs

  • This PR requires documentation updates when merged.

Additional context

@jfecher jfecher requested review from joss-aztec and kevaundray May 18, 2023 19:00
Base automatically changed from jf/simplify-cfg to master May 22, 2023 17:41
Comment thread crates/noirc_evaluator/src/ssa_refactor/opt/simplify_cfg.rs
@TomAFrench TomAFrench changed the title chore(ssa refactor): Optimize constant jmpifs into jmps chore(ssa refactor): Optimize constant jmpifs into jmps May 23, 2023
Copy link
Copy Markdown
Contributor

@joss-aztec joss-aztec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@joss-aztec joss-aztec added this pull request to the merge queue May 23, 2023
Merged via the queue into master with commit 6e0facb May 23, 2023
@joss-aztec joss-aztec deleted the jf/ssa-simplify-constant-if branch May 23, 2023 10:16
TomAFrench added a commit that referenced this pull request May 24, 2023
* master:
  chore(ssa refactor): Add loop unrolling pass (#1364)
  chore: Add terms added in ssa refactor to `cspell` (#1385)
  chore(ssa refactor): Optimize constant `jmpif`s into `jmp`s (#1374)
  feat: Allow warnings by default (#1383)
  chore(github): Update GitHub Pull Request Template (#1370)
  chore(github): Update GitHub Bug Report Template (#1368)
  chore(ssa refactor): Update mem2reg pass to work with multiple functions and blocks (#1375)
  chore(ssa refactor): Add pass to simplify the control flow graph (#1373)
  chore(github): Update GitHub Feature Request Template (#1369)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants